﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web
{
    public class Funciones
    {
        //ATRIBUTOS
        public static string RutaPapelOffice = "Data Source=localhost;Initial Catalog=PapelOffice;Integrated Security=True";
 
        //MÉTODOS
        public static DataSet Read_DataBase(string Consulta)
        {
            DataSet datset = new DataSet();
            SqlConnection Conexion = new SqlConnection();
            Conexion.ConnectionString = RutaPapelOffice;
            SqlDataAdapter da = new SqlDataAdapter(Consulta, Conexion);
            da.Fill(datset, "TablaAux");
            return datset;
        }

        public static void Insert_DataBase(string Consulta)
        {
            DataSet datset = new DataSet();
            SqlConnection Conexion = new SqlConnection();
            Conexion.ConnectionString = RutaPapelOffice;
            SqlDataAdapter da = new SqlDataAdapter(Consulta, Conexion);
            da.Fill(datset, "TablaAux");
        }

        public static void Cargar_DropDown(string Consulta, string Id, string Etiqueta, ref DropDownList  Drop)
        {
            DataSet datset;
            datset = new DataSet();
            datset = Read_DataBase(Consulta);
            Drop.DataSource = datset.Tables[0].DefaultView;
        }
    }
}
